/*
 * $Id: UdpSocket.h,v 1.2 2005-12-25 07:11:46 bacon Exp $
 */

#ifndef _XPP_NET_UDPSOCKET_CLASS_
#define _XPP_NET_UDPSOCKET_CLASS_

#include <xpp/net/InetSocket.h>
#include <xpp/net/InetAddress.h>
#include <xpp/net/Connectable.h>
 
namespace xpp
{
	namespace net
	{

		class UdpSocket: public InetSocket, public Connectable
		{
		public:
			UdpSocket ();

			int open (Handle handle);
			int open (Handle handle, const Address& address);
			int open (const Address& address);

			int connect ();

			xp_ssize_t send (
				const void* data, xp_size_t size, int flags = 0);
			xp_ssize_t sendAll (
				const void* data, xp_size_t size, int flags = 0);
			xp_ssize_t send (
				const void* data, xp_size_t size, 
				const Address& target, int flags = 0);

			xp_ssize_t receive ( 
				void* buf, xp_size_t size, Address* peer, int flags = 0);
			xp_ssize_t receive (
				void* buf, xp_size_t size, int flags = 0);
			xp_ssize_t receiveAll (
				void* buf, xp_size_t size, int flags = 0);
		};

	}
}

#endif
